version: '2.3'
services:
    zoo1:
        image: zookeeper:3.6.2
        restart: always
        environment:
            ZOO_TICK_TIME: 500
            ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
            ZOO_MY_ID: 1
            JVMFLAGS: -Dzookeeper.forceSync=no
            ZOO_SECURE_CLIENT_PORT: $ZOO_SECURE_CLIENT_PORT
        command: ["zkServer.sh", "start-foreground"]
        entrypoint: /zookeeper-ssl-entrypoint.sh
        volumes:
            - type: bind
              source: /misc/zookeeper-ssl-entrypoint.sh
              target: /zookeeper-ssl-entrypoint.sh
            - type: bind
              source: /misc/client.crt
              target: /clickhouse-config/client.crt
            - type: ${ZK_FS:-tmpfs}
              source: ${ZK_DATA1:-}
              target: /data
            - type: ${ZK_FS:-tmpfs}
              source: ${ZK_DATA_LOG1:-}
              target: /datalog
    zoo2:
        image: zookeeper:3.6.2
        restart: always
        environment:
            ZOO_TICK_TIME: 500
            ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888
            ZOO_MY_ID: 2
            JVMFLAGS: -Dzookeeper.forceSync=no
            ZOO_SECURE_CLIENT_PORT: $ZOO_SECURE_CLIENT_PORT

        command: ["zkServer.sh", "start-foreground"]
        entrypoint: /zookeeper-ssl-entrypoint.sh
        volumes:
            - type: bind
              source: /misc/zookeeper-ssl-entrypoint.sh
              target: /zookeeper-ssl-entrypoint.sh
            - type: bind
              source: /misc/client.crt
              target: /clickhouse-config/client.crt
            - type: ${ZK_FS:-tmpfs}
              source: ${ZK_DATA2:-}
              target: /data
            - type: ${ZK_FS:-tmpfs}
              source: ${ZK_DATA_LOG2:-}
              target: /datalog
    zoo3:
        image: zookeeper:3.6.2
        restart: always
        environment:
            ZOO_TICK_TIME: 500
            ZOO_SERVERS: server.1=zoo1:2888:3888;2181 server.2=zoo2:2888:3888;2181 server.3=zoo3:2888:3888;2181
            ZOO_MY_ID: 3
            JVMFLAGS: -Dzookeeper.forceSync=no
            ZOO_SECURE_CLIENT_PORT: $ZOO_SECURE_CLIENT_PORT
        command: ["zkServer.sh", "start-foreground"]
        entrypoint: /zookeeper-ssl-entrypoint.sh
        volumes:
            - type: bind
              source: /misc/zookeeper-ssl-entrypoint.sh
              target: /zookeeper-ssl-entrypoint.sh
            - type: bind
              source: /misc/client.crt
              target: /clickhouse-config/client.crt
            - type: ${ZK_FS:-tmpfs}
              source: ${ZK_DATA3:-}
              target: /data
            - type: ${ZK_FS:-tmpfs}
              source: ${ZK_DATA_LOG3:-}
              target: /datalog
